<?php
class VCoreModule extends CWebModule
{
	public function init()
	{
		// this method is called when the module is being created
		// you may place code here to customize the module or the application

		// import the module-level models and components
		$this->setImport(array(
			'VCore.models.*',
			'VCore.components.*',
		));
	}

	public function beforeControllerAction($controller, $action)
	{
		if(parent::beforeControllerAction($controller, $action))
		{
			// this method is called before any module controller action is performed
			// you may place customized code here
			return true;
		}
		else
			return false;
	}

    public function getMenus(){
        $menus = array(
            'locale' => array(
                'Title' => 'Language &amp; translation',
                'Url' => '/Cms/admin/locale',
                'Menus' => array(
                    'supportedLanguages' => array('Title' => 'Supported languages', 'Url' => '/Cms/admin/locale/supportedLanguages'),
                )
            ),
            'parameters' => array(
                'Title' => 'Manage Paramaters',
                'Url' => '/Cms/admin/settings/list',
                'Menus' => array(
                    'listParameters' => array('Title' => 'Parameters by Modules', 'Url' => '/Cms/admin/settings/list'),
                    'createParameter' => array('Title' => 'Create parameter', 'Url' => '/Cms/admin/settings/create'),
                    'rebuildCache' => array('Title' => 'Rebuild cache', 'Url' => '/Cms/admin/settings/rebuildCache')
                )
            ),
            'hidden' => array(
                'Title' => 'BackOffice',
                'Url' => '',
                'Type' => 'hidden',
                'Menus' => array(
                    'modules' => array('Title' => 'Module list', 'Url' => '/BackOffice/admin/modules/index'),
                    'adminHomePage' => array('Title' => 'Admin home page', 'Url' => '/Cms/admin/home/index'),
                    'dashboard' => array('Title' => 'Dashboard pages', 'Url' => '/Cms/admin/modules/dashboard'),
                ),
            ),
            'moduleManagement' => array(
                'Title' => 'Module Management',
                'Url' => '',
                'Type' => 'hidden',
                'ShowOnModuleList' => 'Yes',
                'Menus' => array(
                    'manageModules' => array('Title' => 'Manage modules', 'Url' => '/BackOffice/admin/modules/all'),
                    'versionChecker' => array('Title' => 'Version checker', 'Url' => '/BackOffice/admin/modules/versionChecker'),
                    'newsFromFlexicaCms' => array('Title' => 'News from FlexiCms', 'Url' => '/Cms/admin/modules/newsFromFlexicaCms'),
                    'createModule' => array('Title' => 'Create new module', 'Url' => '/BackOffice/admin/generator/createModule'),
                ),
            ),
            'codeGenerator' => array(
                'Title' => 'Code generator',
                'Url' => '',
                'Type' => 'hidden',
                'ShowOnModuleList' => 'Yes',
                'Menus' => array(
                    'installModule' => array('Title' => 'Install module', 'Url' => '/Cms/admin/modules/install'),
                    'adminPages' => array('Title' => 'Admin pages', 'Url' => '/Cms/admin/generator/adminPages'),
                    'createInstaller' => array('Title' => 'Create installer', 'Url' => '/Cms/admin/generator/createInstaller'),
                    'addMultiLang' => array('Title' => 'Add multi-language support', 'Url' => '/Cms/admin/generator/addMultiLanguage'),
                )
            ),
            'pluginsHooks' => array(
                'Title' => 'Plugins &amp; Hooks',
                'Url' => '',
                'Type' => 'hidden',
                'ShowOnModuleList' => 'Yes',
                'Menus' => array(
                    'enablePlugin' => array('Title' => 'Enable/Disable', 'Url' => '/BackOffice/admin/plugin/list'),
                    'install' => array('Title' => 'Install', 'Url' => '/BackOffice/admin/plugin/install'),
                    'uninstall' => array('Title' => 'Uninstall', 'Url' => '/BackOffice/admin/plugin/uninstall'),
                )
            ),
        );
        return $menus + parent::getMenus();
    }
}
